package o;

import java.io.PrintWriter;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.HashMap;
import java.util.Map;

public class fjl<T> implements ffc, Cloneable {
    private transient InvocationHandler handler = new InvocationHandler(this) {
        final /* synthetic */ fjl ˎ;

        {
            this.ˎ = r1;
        }

        public Object invoke(Object obj, Method method, Object[] objArr) throws Throwable {
            String name = method.getName();
            if (name.startsWith("set")) {
                this.ˎ.mValues.put(name.substring(3), objArr[0]);
                return null;
            }
            Object substring;
            if (name.startsWith("get")) {
                substring = name.substring(3);
            } else if (!name.startsWith("is")) {
                return null;
            } else {
                substring = name.substring(2);
            }
            substring = this.ˎ.mValues.get(substring);
            if (substring == null && method.getReturnType().isPrimitive()) {
                return fjl.getReturnValue(method);
            }
            return substring;
        }
    };
    private final transient Class<T> mInterface;
    private Map<String, Object> mValues = new HashMap();

    static {
        if (Boolean.FALSE.booleanValue()) {
            new Throwable().printStackTrace((PrintWriter) null);
        }
    }

    public static String resolveName(String str) {
        if (str.startsWith("set")) {
            return str.substring(3);
        }
        if (str.startsWith("get")) {
            return str.substring(3);
        }
        return null;
    }

    public fjl(Class<T> cls) {
        if (fja.class.isAssignableFrom(cls)) {
            this.mInterface = cls;
            return;
        }
        throw new IllegalArgumentException(cls + " must extends from PojoObject.");
    }

    public T get() {
        return Proxy.newProxyInstance(this.mInterface.getClassLoader(), new Class[]{this.mInterface}, this.handler);
    }

    public fjl<T> clone() {
        fjl<T> o_fjl = new fjl(this.mInterface);
        o_fjl.mValues.putAll(this.mValues);
        return o_fjl;
    }

    public Class<T> getInterface() {
        return this.mInterface;
    }

    public void setValue(String str, Object obj) {
        this.mValues.put(str, obj);
    }

    private static Object getReturnValue(Method method) {
        Class returnType = method.getReturnType();
        if (returnType == Integer.TYPE) {
            return Integer.valueOf(0);
        }
        if (returnType == Long.TYPE) {
            return Long.valueOf(0);
        }
        if (returnType == Short.TYPE) {
            return Short.valueOf((short) 0);
        }
        if (returnType == Float.TYPE) {
            return Float.valueOf(0.0f);
        }
        if (returnType == Double.TYPE) {
            return Double.valueOf(0.0d);
        }
        if (returnType == Boolean.TYPE) {
            return Boolean.valueOf(false);
        }
        if (returnType == Character.TYPE) {
            return Character.valueOf('\u0000');
        }
        if (returnType == Byte.TYPE) {
            return Byte.valueOf((byte) 0);
        }
        if (returnType != Void.TYPE) {
            return null;
        }
        throw new TypeNotPresentException("Getter method '" + method.getName() + "' cannot return a value with void type", null);
    }
}
